﻿using System.Collections.Generic;
using ZilLion.Task.Domain.Taskmanager.Entity;
using ZilLion.Task.Domain.Taskmanager.Repository;

namespace ZilLion.Task.Domain.Taskmanager.Service
{
    public class TaskConfigService : BaseService, ITaskConfigService
    {
        private readonly ITaskConfigRespository _taskConfigRespository;

        public TaskConfigService(ITaskConfigRespository taskConfigRespository)
        {
            _taskConfigRespository = taskConfigRespository;
        }

        public IEnumerable<TaskConfig> GetTaskConfigs()
        {
            var response = _taskConfigRespository.GetConfigResponse();
            if ((response != null) && (response.TaskConfigList != null))
                return response.TaskConfigList;
            return new List<TaskConfig>();
        }

        public bool DownLoadPackage(string mouduleid, string savepath)
        {
         return   _taskConfigRespository.DownLoadPackage(mouduleid, savepath);
        }

        public bool SaveConfig(TaskConfig entity)
        {
          return  _taskConfigRespository.SaveConfig(entity);
        }
    }
}